import json


def get_and_dump_number(file_name):
    """输入并在文件中储存数字"""
    favorite_number = int(input('Enter your favorite number: '))
    with open(file_name, 'w') as file_obj:
        json.dump(favorite_number, file_obj)


def print_number(file_name):
    """打印文件中的数字"""
    with open(file_name) as file_obj:
        favorite_number = json.load(file_obj)
        print('I know your favorite number! It is ' + str(favorite_number) + '.')